import request from '@/utils/request'
import type { DimensionQuery, Dimension, DimensionForm } from '@/types/dimension'
import type { PageResult } from '@/types/common'

// 获取维度列表
export function getDimensionList(params: DimensionQuery) {
  return request<PageResult<Dimension>>({
    url: '/test-dimensions/list',
    method: 'get',
    params
  })
}

// 获取维度详情
export function getDimension(id: number) {
  return request<Dimension>({
    url: `/test-dimensions/${id}`,
    method: 'get'
  })
}

// 创建维度
export function createDimension(data: DimensionForm) {
  return request<void>({
    url: '/test-dimensions',
    method: 'post',
    data
  })
}

// 更新维度
export function updateDimension(id: number, data: DimensionForm) {
  return request<void>({
    url: `/test-dimensions/${id}`,
    method: 'put',
    data
  })
}

// 删除维度
export function deleteDimension(id: number) {
  return request<void>({
    url: `/test-dimensions/${id}`,
    method: 'delete'
  })
} 